package com.sishuok.architecture1.goodsmgr;

import com.sishuok.architecture1.goodsmgr.service.IGoodsService;
import com.sishuok.architecture1.goodsmgr.vo.GoodsModel;
import com.sishuok.architecture1.goodsmgr.vo.GoodsQueryModel;
import com.sishuok.pageutil.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

/**
 * Created by qi on 2018/11/24.
 */
@Service
//@Transactional
public class Client {
    @Autowired
    private IGoodsService s = null;

    public IGoodsService getS(){
        return s;
    }

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        Client t = (Client) ctx.getBean("client");
        GoodsModel model = new GoodsModel();
        model.setName("c1");
        model.setImgPath("c1");
        model.setDescription("111");
        t.s.create(model);

        GoodsQueryModel cqm = new GoodsQueryModel();
        cqm.getPage().setNowPage(1);
        cqm.getPage().setPageShow(4);
        Page<GoodsModel> list = t.getS().getByConditionPage(cqm);
        System.out.println("list =="+list);


    }
}
